class Solution
{
public:
    vector<int> arrayChange(vector<int> &nums, vector<vector<int>> &operations)
    {
        unordered_map<int, int> indexMap;
        int n = nums.size();
        for (int i = 0; i < n; ++i)
        {
            indexMap[nums[i]] = i;
        }
        for (auto &operation : operations)
        {
            int id = indexMap[operation[0]];
            nums[id] = operation[1];
            indexMap[operation[1]] = id;
        }
        return nums;
    }
};